package com.intelligent.bot.service.keyConfig.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.intelligent.bot.base.result.B;
import com.intelligent.bot.dao.KeyNumberConfigDao;
import com.intelligent.bot.model.KeyNumberConfig;
import com.intelligent.bot.service.keyConfig.KeyNumberConfigService;
import org.springframework.stereotype.Service;



/**
* @author Dreams
* @description 针对表【key_number_config(key消耗配置)】的数据库操作Service实现
* @createDate 2023-11-07 15:50:44
*/
@Service
public class KeyNumberConfigServiceImpl extends ServiceImpl<KeyNumberConfigDao, KeyNumberConfig>
    implements KeyNumberConfigService {


    @Override
    public B<KeyNumberConfig> queryPage() {
        KeyNumberConfig keyNumberConfig = this.lambdaQuery().eq(KeyNumberConfig::getId, 1).one();
        return B.okBuild(BeanUtil.copyProperties(keyNumberConfig, KeyNumberConfig.class));
    }

    @Override
    public B<Void> update(KeyNumberConfig req) {
        KeyNumberConfig keyNumberConfig = BeanUtil.copyProperties(req, KeyNumberConfig.class);
        this.updateById(keyNumberConfig);
        return B.okBuild();
    }
}




